home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Applications / Moscow ML 1.31 / source code / mosml / src / mosmllib / Math.sml < prev    next >
Encoding:
Text File  |  1996-07-03  |  664 b   |  32 lines  |  [TEXT/R*ch]

  1. (* Math.sml, 1995-02-21 *)
  2.  
  3. type real = real
  4.  
  5. exception Sqrt = Sqrt
  6.       and Ln   = Ln
  7.       and Trig = Trig;
  8.  
  9. val pi = 3.14159265358979323846;
  10. val e  = 2.7182818284590452354;
  11.  
  12. val sqrt = sqrt;
  13. val sin  = sin
  14. val cos  = cos
  15. fun tan r = (sin r / cos r) handle _ => raise Trig;
  16. val atan = arctan;
  17.  
  18. prim_val asin   : real -> real         = 1 "sml_asin";
  19. prim_val acos   : real -> real         = 1 "sml_acos";
  20.  
  21. local 
  22.     prim_val atan2_ : real -> real -> real = 2 "sml_atan2";
  23.     prim_val pow_   : real -> real -> real = 2 "sml_pow";
  24. in
  25.     fun atan2(x, y) = atan2_ x y;
  26.     fun pow (x, y) = pow_ x y;
  27. end
  28.  
  29. val exp = exp;
  30. val ln = ln;
  31. fun log10 r = ln r / ln 10.0;
  32.